Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Status should ensure CNI Network Configuration and CNI binaries in the NetConf are present to set Network Ready #116

Closed
wants to merge 8 commits into from

Conversation

MikeZappa87
Copy link
Contributor

@MikeZappa87 MikeZappa87 commented Apr 5, 2024

It seems like issues are popping up where the CNI network configuration is present but no CNI binaries present and the node is being marked ready.

@MikeZappa87 MikeZappa87 force-pushed the bug/musthavebinaries branch 6 times, most recently from a3a2a92 to 545b30e Compare April 5, 2024 21:26
@MikeZappa87 MikeZappa87 marked this pull request as ready for review April 5, 2024 21:26
cni.go Outdated
@@ -140,6 +141,19 @@ func (c *libcni) Status() error {
if len(c.networks) < c.networkCount {
return ErrCNINotInitialized
}

for _, dir := range c.pluginDirs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit.. per discussion offline we could/should do this check on load instead.. TODO: consider if need to add a listener on the plugindirs to know when to reload as we do on the config path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hesitation on doing to much here given the better design coming with the kni/cni daemons.. might want to ignore the TODO for now

@MikeZappa87 MikeZappa87 force-pushed the bug/musthavebinaries branch 2 times, most recently from c955814 to 5d2d968 Compare April 5, 2024 23:36
opts.go Outdated
plugin := plug.Network.Type

if !fileExistsInDir(c.pluginConfDir, plugin) {
return ErrCNIPluginNotFound
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return ErrCNIPluginNotFound
return fmt.Errorf("CNI plugin not found in %s/%s: %w", c.pluginConfDir, plugin, ErrInvalidConfig)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts? Not following the need to have a plurality of different error types for what amounts to incorrect cni config..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought from the reader of the error message if I see the invalid cni config, I'm going to look at /etc/cni/net.d. If I see cni plugin not found, I'm looking at /opt/cni/bin. This helps reduce the troubleshooting time. The error message could be improved to give the reader the directories. I'm just thinking about it that way. Invalid config means something much different than cni plugin not found.

@MikeZappa87 MikeZappa87 force-pushed the bug/musthavebinaries branch from b78ecc0 to 0252662 Compare April 6, 2024 02:55
@MikeZappa87 MikeZappa87 marked this pull request as draft April 6, 2024 02:59
@MikeZappa87
Copy link
Contributor Author

I need to handle the case where multiple cni bin directories are specified. The binary needs to exist in one of these directories and the last checked directory could have the binary. In the current the first would be checked and fail.

@MikeZappa87 MikeZappa87 marked this pull request as ready for review April 6, 2024 04:02
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple questions on the plugin check(s)

opts.go Outdated Show resolved Hide resolved
opts.go Outdated Show resolved Hide resolved
opts.go Outdated Show resolved Hide resolved
@MikeZappa87 MikeZappa87 force-pushed the bug/musthavebinaries branch from 46c7c4f to 6ec6275 Compare April 8, 2024 12:19
@MikeZappa87 MikeZappa87 marked this pull request as draft April 8, 2024 17:03
@MikeZappa87 MikeZappa87 force-pushed the bug/musthavebinaries branch from d8657e1 to 5d1202a Compare April 8, 2024 20:05
@MikeZappa87 MikeZappa87 marked this pull request as ready for review April 8, 2024 20:06
errors.go Outdated
ErrInvalidResult = errors.New("invalid result")
ErrLoad = errors.New("failed to load cni config")
ErrCNIPluginNotFound = errors.New("cni plugin not found")
ErrCNIPluginDirNotFound = errors.New("cni plugin directory not found")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used..

Signed-off-by: Michael Zappa <[email protected]>
Signed-off-by: Michael Zappa <[email protected]>
Signed-off-by: Michael Zappa <[email protected]>
Signed-off-by: Michael Zappa <[email protected]>
@MikeZappa87 MikeZappa87 marked this pull request as draft April 15, 2024 17:21
@MikeZappa87 MikeZappa87 changed the title Status should ensure CNI Network Configuration and CNI binaries in the NetConf are present to set Network Ready [DRAFT] Status should ensure CNI Network Configuration and CNI binaries in the NetConf are present to set Network Ready Apr 15, 2024
Signed-off-by: Michael Zappa <[email protected]>
Signed-off-by: Michael Zappa <[email protected]>
Signed-off-by: Michael Zappa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants